package com.gitee.ec.common;

import lombok.Getter;

import java.util.List;
import java.util.Objects;

/**
 * {@link <a href="https://www.voidtools.com/zh-cn/support/everything/sdk/everything_setrequestflags/">请求项对照表</a>}
 *
 * @author hongda.li
 */
@Getter
public enum OutputItemName {
    /**
     * 文件名称
     */
    EVERYTHING_REQUEST_FILE_NAME(0x00000001),
    /**
     * 文件所在目录路径
     */
    EVERYTHING_REQUEST_PATH(0x00000002),
    /**
     * 文件全路径
     */
    EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME(0x00000004),
    /**
     * 文件后缀名
     */
    EVERYTHING_REQUEST_EXTENSION(0x00000008),
    /**
     * 文件大小
     */
    EVERYTHING_REQUEST_SIZE(0x00000010),
    /**
     * 文件修改时间
     */
    EVERYTHING_REQUEST_DATE_MODIFIED(0x00000040);

    private final int value;

    OutputItemName(int value) {
        this.value = value;
    }

    @SuppressWarnings("ReassignedVariable")
    public static int calculate(List<OutputItemName> outputList) {
        Objects.requireNonNull(outputList);
        int result = 0;
        for (OutputItemName name : outputList) {
            result = result | name.getValue();
        }
        return result;
    }
}
